import request from '@utils/request'

// 分页
export function getModelList (query) {
  return request({
    url: '/model/list',
    method: 'get',
    params: query,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 保存编辑模型
export function submitModel (data) {
  return request({
    url: '/model/submit',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 详情
export function getDetail (query) {
  return request({
    url: '/model/detail',
    method: 'get',
    params: query,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除模型
export function removeModel (query) {
  return request({
    url: '/model/remove?ids='+query.ids,
    method: 'post',
    data: query,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 部署模型
export function deployModel (query) {
  return request({
    // url: '/model/deploy?modelId='+query.modelId+'category='+query.category+'tenantIds='+query.tenantIds,
    url: '/model/deploy',
    method: 'post',
    data: query,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}